﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Inaction.UI.MenuManage
{
    internal partial class TypeSelecteForm : Form
    {
        public Type SelectedType { get; private set; }
        public TypeSelecteForm()
        {
            InitializeComponent();
            TopLevel = false;
        }

        public TypeSelecteForm(List<Type> types)
        {
            InitializeComponent();
            typesBindingSource.DataSource = types;
        }

        private void gridView_DoubleClick(object sender, EventArgs e)
        {
            var obj = gridView.GetRow(gridView.FocusedRowHandle) as Type;
            if (obj == null) return;
            SelectedType = obj;
            Close();
        }
    }
}
